﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using com.cgWorkstudio.BIMP.Library.Properties;

namespace com.cgWorkstudio.BIMP.Library.uc {
    public partial class UC_CloseButton:UserControl {

        bool mouseMoving = false;
        public UC_CloseButton() {
            InitializeComponent();
            this.MouseMove += new MouseEventHandler(UC_CloseButton_MouseMove);
            this.MouseDown += new MouseEventHandler(UC_CloseButton_MouseDown);
            this.MouseLeave += new EventHandler(UC_CloseButton_MouseLeave);
            this.MouseUp += new MouseEventHandler(UC_CloseButton_MouseUp);
        }

        void UC_CloseButton_MouseUp(object sender,MouseEventArgs e) {
            mouseMoving = true;
            this.BackgroundImage = Resources.Png_Close_Default;
        }

        void UC_CloseButton_MouseLeave(object sender,EventArgs e) {
            mouseMoving = false;
            this.BackgroundImage = Resources.Png_Close_Default;
        }

        void UC_CloseButton_MouseDown(object sender,MouseEventArgs e) {
            mouseMoving = true;
            this.BackgroundImage = Resources.Png_Close_Down;
        }

        void UC_CloseButton_MouseMove(object sender,MouseEventArgs e) {
            if(mouseMoving == true) {
                return;
            }
            mouseMoving = true;
            this.BackgroundImage = Resources.Png_Close_Hover;
        }
    }
}
